<div id="preview" style="display:none;"></div>
<a name="comment_add"></a>
<? echo $form -> create('articles',array('action'=>$url.'/comments','name'=>'commentsAddForm','id'=>'commentsAddForm','onsubmit'=>"new Ajax.Updater({success:'comment_list'}, '".$html -> url('/articles/'.$url.'/comments')."',{asynchronous:true, evalScripts:true,insertion:Insertion.Bottom, onFailure:function(request){failure(request)}, onLoading:function(request){Element.show('comment_loading');}, onComplete:function(request){getElementById('CommentTitle').value='';getElementById('CommentText').value='';getElementById('CommentCaptcha').value='';Element.hide('preview');Element.hide('comment_loading');new Effect.BlindDown($('comment_list').lastChild);}, parameters:Form.serialize(this)}); return false;")); ?>
<ul id="comment_add">
	<li>
	<? echo $form -> hidden('Comment.article_id', array('value' => (empty($_POST) ? $article['Article']['id'] : null))); ?>
	<? echo $form -> hidden('Comment.user_ip',array('value'=>$_SERVER['REMOTE_ADDR'])); ?> 
	</li>
	
	<li><?php echo $form->label('Comment.user_name', __('USERNAME',true));?> <span class="required">(<? __('REQUIRED'); ?>)</span></li>
 	<li><?php echo $form->input('Comment.user_name', array('style'=>'width:250px;','tabindex'=>1,'label'=>false,'value'=>(empty($_POST) ? @$user['username'] : null))); ?></li>
	
	<li><?php echo $form->label('Comment.title', __('TITLE',true));?> <span class="required">(<? __('REQUIRED'); ?>)</span></li>
 	<li><?php echo $form->input('Comment.title', array('style'=>'width:250px;','tabindex'=>2,'label' => false));?></li>

	<li><? echo $texy -> createMenuBar(); ?></li>
	
	<li><?php echo $form->label('Comment.text', __('TEXT',true));?> <span class="required">(<? __('REQUIRED'); ?>)</span> <span class="required"><? echo $html -> link(__('TEXY_HELP_TEXT',true),'http://texy.info/cs/syntax',array('target'=>'blank')); ?></span></li>
 	<li><?php echo $form->textArea('Comment.text', array("rows" => 15, "cols" => 60,'tabindex'=>3));?></li>

    <li><?php echo $form->label('Comment.captcha', __(Configure::read('Captcha.question'),true));?> <span class="required">(<? __('REQUIRED'); ?>)</span></li>
 	<li><?php echo $form->input('Comment.captcha', array('style'=>'width:250px;','tabindex'=>4,'label' => false));?></li>

    <li>
		<div id="badinput">
	 		<?php echo $form->input('Comment.badinput', array('size' => '60'));?>
		</div>
	</li>
	
	<li>
		<span id="comment_loading" style="display: none;"><? echo $html -> image("spinner.gif",array('alt'=>"Spinner")); ?></span>&nbsp;&nbsp;
		<a href="#" onclick="new Ajax.Updater('preview', '<? echo $html -> url('/articles/comment_preview'); ?>',  {asynchronous:true, evalScripts:true, parameters:Form.serialize('commentsAddForm'),onLoading:function(request){Element.show('comment_loading')} ,onComplete:function(request){Element.hide('comment_loading');Element.show('preview')}}); return false;"><? __('PREVIEW'); ?></a>
	 	<?php echo $form->submit(__('SEND',true),array('div'=>false,'tabindex'=>5));?>
 	</li>
</ul>
</form>